package com.example.cwt101_group.merchant.service.impl;

import com.example.cwt101_group.merchant.mapper.MerchantMapper;
import com.example.cwt101_group.merchant.params.MerchantRequestParams;
import com.example.cwt101_group.merchant.pojo.Merchant;
import com.example.cwt101_group.merchant.service.MerchantService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service // 表示业务层
public class MerchantServiceImpl implements MerchantService {

    @Resource
    // equivalent: MerchantMapper merchantMapper = new MerchantMapper()
    private MerchantMapper merchantMapper;
    @Override
    public int addMerchant(MerchantRequestParams MerchantRequestParams) {
        //添加注册
        return merchantMapper.addMerchant(MerchantRequestParams);
    }

    @Override
    public Merchant findMerchantByName(String mname) {
        return merchantMapper.findMerchantByName(mname);
    }

    @Override
    public Merchant login(MerchantRequestParams merchantRequestParams) {
        return merchantMapper.login(merchantRequestParams);
    }

    @Override
    public int updateMerchant(Merchant merchant) {

        return merchantMapper.updateMerchant(merchant);
    }

    @Override
    public List<Merchant> list() {
        return merchantMapper.list();
    }
}
